{% extends "profilebase.html" %}
{% load myprofile_extras %}

{% block sidebar2 %}
</br>
{% if profileOwner %}
	{% if currentUser.category == "student" %}<h4>Questions</h4>{% endif %}
	{% if currentUser.category == "teacher" %}<h4>About Me</h4>{% endif %}
	{% if currentUser.category == "institute" %}<h4>About Us</h4>{% endif %}
	{% if photo %}			
		<img border="0" src={{ photo.path }} />
	{% endif %}
	<br/>
	{% if currentUser.category != "student" %}
		<small>
			<br/>
			<a href="/editInfo/">Edit My Info</a> - 
			{% if photo %}	
				<a href="/myprofile/uploadImage/">Change Photo</a> - 
			{% else %}
				<a href="/myprofile/uploadImage/">Upload a Photo</a> - 
			{% endif %}
			<a href="/myprofile/changePassword/">Change Password</a>
			<br/>
		</small>
	{% endif %}
{% else %}
	<div style="font-size:20;"><b>About {{ currentUser.abstract_user.user.username }}</b></div></br>
	{% if photo %}			
		<img border="0" src={{ photo.path }} />
	{% endif %}
{% endif %}
<br/>


{% if currentUser.category == "teacher" %}
	{% if my_institutes %}
			<b>Works at:</b></br>
			{% for institute in my_institutes|limit_array:4 %}
				<a href="/myprofile/{{ institute.abstract_user.id }}/">{{ institute.abstract_user }}</a><br/>
			{% endfor %}
			{% if my_institutes|length > 4 %}
				<small><a href="/myprofile/connections/{{ currentUser.abstract_user.id }}/">See all</a></small>
			{% endif %}
			</br><br/>
	{% endif %}
{% endif %}


{% if profileOwner %}
	{% if currentUser.category == "institute" %}
	<br/>
		<b>About: </b><br/>{{ currentUser.about|default:"Tell us all about your institute" }}<br/><br/>
		{% if my_teachers %}
			<b>Our Teachers:</b><br/>
				{% for teacher in my_teachers|limit_array:4 %}
					<a href="/myprofile/{{ teacher.abstract_user.id }}/">{{ teacher.abstract_user }}</a><br/>
					{% if teacher.teaches %}
						<small>Teaches: {{ teacher.teaches }}</small>
					{% endif %}
				{% endfor %}
			{% if my_teachers|length == 4 %}
				<small><a href="/myprofile/connections/{{ currentUser.abstract_user.id }}/">See all</a></small>
			{% endif %}
			<br/><br/>
		{% endif %}
		<b>Open On: </b><br/>{{ currentUser.open_on|default:"Ahm, is it closed all week long?" }}<br/><br/>
		<b>Open From: </b><br/>{{ currentUser.open_from|default:"Is it open 24hrs aday?" }}<br/><br/>
		<b>Open To: </b><br/>{{ currentUser.open_to|default:"Never closes?"}}<br/><br/>
		<b>Address: </b><br/>{{ currentUser.address|default:"Even if you're located on Mars, you can tell us, we really don't mind" }}<br/><br/>
		<b>Contact Info: </b><br/>{{ currentUser.contact_info|default:"Are you reachable? Phone?" }}<br/><br/>
		<small style="text-align:center">
		<a href="/editInfo/">Edit My Info</a> - 
		{% if photo %}	
			<a href="/myprofile/uploadImage/">Change Photo</a> - 
		{% else %}
			<a href="/myprofile/uploadImage/">Upload a Photo</a> - 
		{% endif %}
		<a href="/myprofile/changePassword/">Change Password</a>
	</small>
	{% elif currentUser.category == "teacher" %}
	
		<b>Date of Birth: </b><br/>{{ currentUser.dob|default:"Not entered yet" }}<br/><br/>
		<b>Gender: </b><br/>{{ currentUser.gender|default:"Are you unsure?" }}<br/><br/>
		<b>Experience: </b><br/>{{ currentUser.experience|default:"Come on, BRAG!" }}<br/><br/>
		<b>Favorite Genre/s: </b><br/>{{ currentUser.favourite_genre|default:"Hmm, you must like something, right?" }}<br/><br/>
		<b>Instrument/s Played: </b><br/>{{ currentUser.instrument_played|default:"Ahm, it is kind of in the definition of a musician to play something. Unless you're a vocalist...'" }}<br/><br/>
		<b>Jamming Style: </b><br/>{{ currentUser.jamming_style|default:"Tell us..." }}<br/><br/>
		<b>Teach: </b><br/>{{ currentUser.teaches|default:"Advertise for yourself..." }}<br/><br/>
		<small style="text-align:center">
			<a href="/editInfo/">Edit My Info</a> - 
			{% if photo %}	
				<a href="/myprofile/uploadImage/">Change Photo</a> - 
			{% else %}
				<a href="/myprofile/uploadImage/">Upload a Photo</a> - 
			{% endif %}
			<a href="/myprofile/changePassword/">Change Password</a>
		</small>
	{% else %}
		{% if del_success_message %}
			<font class="success">{{ del_success_message }}</font><br/><br/>
		{% endif %}
		
		<ol>
			{% for question in questions %}
				<li>
					<b>{{ question }}</b> <br/>
					<small style="font-style:italic; float:right"><a href="/myprofile/deleteReviewQuestion/{{ question.id }}/">delete</a></small>
				</li><br/>
			{% empty %}
				You don't have any questions yet
			{% endfor %}
		</ol>
		<hr/>
		<h4>Add a new question</h4>
		{% if add_success_message %}
			<font class="success">{{ add_success_message }}</font><br/><br/>
		{% endif %}
		<form action="/myprofile/addReviewQuestion/" method="POST">{% csrf_token %}
			<input type="text" name="content" style="width:100%"/><br/><br/>
			<input type="image" src="{{ STATIC_URL }}images/add_btn.jpg" alt='Submit Form' style="float:right;">
		</form>			
	{% endif %}

	
{% else %}
	{% if currentUser.category == "institute" %}
		{% if currentUser.about %}
			<b>About: </b><br/>{{ currentUser.about }}<br/><br/>
		{% endif %}
		{% if my_teachers %}
			<b>Our Teachers:</b><br/>
				{% for teacher in my_teachers|limit_array:4 %}
					<a href="/myprofile/{{ teacher.abstract_user.id }}/">{{ teacher.abstract_user }}</a><br/>
					{% if teacher.teaches %}
						<small>Teaches: {{ teacher.teaches }}</small>
					{% endif %}
				{% endfor %}
			{% if my_teachers|length == 4 %}
				<small><a href="/myprofile/connections/{{ currentUser.abstract_user.id }}/">See all</a></small>
			{% endif %}
			<br/><br/>
		{% endif %}
		{% if currentUser.open_on %} 
			<b>Open On: </b><br/>{{ currentUser.open_on }}<br/> <br/>
		{% endif %}
		{% if currentUser.open_from %} 
			<b>Open From: </b><br/>{{ currentUser.open_from }}<br/> <br/>
		{% endif %}
		{% if currentUser.open_to %} 
			<b>Open To: </b><br/>{{ currentUser.open_to }}<br/> <br/>
		{% endif %}
		{% if currentUser.address %} 
			<b>Address: </b><br/>{{ currentUser.address }}<br/> <br/>
		{% endif %}
		
	{% else %}
	
		{% if currentUser.dob %} 
			<b>Date of Birth: </b><br/>{{ currentUser.dob }}<br/> <br/>
		{% endif %}
		{% if currentUser.gender %} 
			<b>Gender: </b><br/>{{ currentUser.gender }}<br/> <br/>
		{% endif %}
		{% if currentUser.experience %} 
			<b>Experience: </b><br/>{{ currentUser.experience }}<br/> <br/>
		{% endif %}
		{% if currentUser.favourite_genre %} 
			<b>Favourite Genre/s: </b><br/>{{ currentUser.favourite_genre }}<br/> <br/>
		{% endif %}
		{% if currentUser.instrument_played %} 
			<b>Instrument/s Played: </b><br/>{{ currentUser.instrument_played }}<br/> <br/>
		{% endif %}
		{% if currentUser.jamming_style %} 
			<b>Jamming Style: </b><br/>{{ currentUser.jamming_style }}<br/> <br/>
		{% endif %}
		
		{% if currentUser.category == "teacher" %}
			{% if currentUser.teaches %}
				<b>Teach: </b><br/>{{ currentUser.teaches }}<br/><br/>
			{% endif %}
		{% endif %}
			
	{% endif %}
	
{% endif %}

	
{% endblock %}


{% block content %}
<div style="font-size:30;"><b><a href="/myprofile/{{ currentUser.abstract_user.id }}/">{{ currentUser.abstract_user }}'s</a> Reviews</b></div>

{% if reviews %}
	<small>What everyone thinks of {{ currentUser.abstract_user.user.username }}</small>
{% endif %}
<br/><br/>


{% if not profileOwner and areFriends %}
	{% if media %}
		<form action="/myprofile/postMediaReview/{{ currentUser.abstract_user.id }}/{{ media.id }}/" method="POST">{% csrf_token %}
			{% if review_success_message %}
				<font class="success">{{ review_success_message }}</font><br/><br/>
			{% endif %}
			
			{%  if media.video_id %}
				<iframe width="560" height="315" src="http://www.youtube.com/embed/{{ media.video_id }}" frameborder="0" allowfullscreen></iframe>
				<br/>
			{% else %}
				<object height="100" width="100%"> 
				<param name="movie" value={{ media.mp3_url }}/> 
			</object> 
			<br/>
			{% endif %}
			<br/>
			<textarea name="content" size=80 style="height:100px;width:100%"></textarea><br/>
			<p style="text-align:right;"><input type="image" src="{{ STATIC_URL }}images/post_btn.jpg" alt='Submit Form'></p>
		</form>
	{% else %}
		<form action="/myprofile/postReview/{{ currentUser.abstract_user.id }}/" method="POST">{% csrf_token %}
			{% if review_success_message %}
				<font class="success">{{ review_success_message }}</font><br/><br/>
			{% endif %}
			
			{% if currentUser.category == "student" %}
				{% for question in questions %}
					<b>{{ question }}</b><br/><br/>
					<input type="text" style="width:200px" name="question_{{ question.id }}"/>
					<br/><br/>
				{% endfor %}
			{% endif %}
			{% if currentUser.category == "student" %}
				<b>Other Comments:</b>
			{% endif %}
		
			<textarea name="content" size=80 style="height:100px;width:100%;"></textarea><br/>
			
			{% if currentUser.category == "student" %}
				<input type="radio" name="category" value="public" checked="checked" /> Public
				<input type="radio" name="category" value="private" /> Private <br/><br/>
			{% endif %}
			<p style="text-align:right;"><input type="image" src="{{ STATIC_URL }}images/post_btn.jpg" alt='Submit Form'></p>
		</form>
	{% endif %}
{% endif %}

{% for review, photo in reviews %}
	<p>
		<a href="/myprofile/{{ review.reviewer.id }}/">
			{% comment %}
				<img  hight="100" width="100" border="0" src={{ photo.path }} />
			{% endcomment %}
			<font style="vertical-align:top; font-size:19">{{ review.reviewer }}:</font></a>
			<small style="text-align:right;font-style:italic;float:right">{{ review.date }}</small>
			<br/><br/>
		
		{% if review.media %}
			{%  if review.media.video_id %}
				<iframe width="200" height="100" src="http://www.youtube.com/embed/{{ review.media.video_id }}" frameborder="0" allowfullscreen></iframe>
			{% else %}
				<object height="100" width="100%"> 
					<param name="movie" value={{ review.media.mp3_url }}/> 
				</object>
			{% endif %}
		{% endif %}
		<font style="vertical-align:top; font-size:19">{{ review.content|safe }}</font>
		<br/>

		<small style="text-align:right;font-style:italic;float:right">
			{% if review.report_count > 0 %}
				Reported, <a href="/myprofile/report/{{ review.id }}/{{ currentUser.abstract_user.id }}/">Report again</a> 
			{% else %}
				<a href="/myprofile/report/{{ review.id }}/{{ currentUser.abstract_user.id }}/">Report</a>
			{% endif %}
		</small><br/>
		
	</p>
	<br/>
{% empty %}
{{ currentUser.abstract_user }} doesn't have any reviews yet.
{% endfor %}
{% if more_reviews_available %}
<br/>
<li><small><a href="/myprofile/viewMoreReviews/{{ currentUser.abstract_user.id }}/{{ reviews|length }}">view more reviews</a></small></li>
{% endif %}
{% endblock %}
